#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>

using namespace std;

int ret = 0;
vector<bool> check;
vector<int> path;


void dfs(int n, int pos)

{
    if (pos == n + 1)
    {
        ret++;
        return;
    }

    for (int i = 1; i <= n; ++i)
    {
        if (check[i] == false)
        {
            if (i % pos == 0 || pos % i == 0)
            {
                path.push_back(i);
                check[i] = true;
                dfs(n, pos + 1);
                check[i] = false;
                path.pop_back();
            }

        }
    }
}

int countArrangement(int n) {
    check.resize(n + 1);
    dfs(n, 1);
    return ret;
}

int main()
{
    countArrangement(2);
	return 0;
}